<!doctype html>
<html lang="en"><head>
    <meta charset="utf-8">
    <title>后台管理</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!--link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'-->
    <link rel="stylesheet" type="text/css" href="<?php echo VIEW.'admin/'?>lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="<?php echo VIEW.'admin/'?>lib/font-awesome/css/font-awesome.css">

    <script src="<?php echo VIEW.'admin/'?>lib/jquery-1.11.1.min.js" type="text/javascript"></script>

    <script src="<?php echo VIEW.'admin/'?>lib/jQuery-Knob/js/jquery.knob.js" type="text/javascript"></script>

    <link rel="stylesheet" type="text/css" href="<?php echo VIEW.'admin/'?>stylesheets/theme.css">
    <link rel="stylesheet" type="text/css" href="<?php echo VIEW.'admin/'?>stylesheets/premium.css">

</head>
<body class="theme-blue">

<!-- header white -->
<style type="text/css">
    #line-chart {
        height:300px;
        width:800px;
        margin: 0px auto;
        margin-top: 1em;
    }
    .navbar-default .navbar-brand, .navbar-default .navbar-brand:hover {
        color: #fff;
    }
</style>

<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="../assets/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">


<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->

<!--<![endif]-->

<div class="navbar navbar-default" role="navigation">
    <div class="navbar-header">
        <a class="navbar-brand" href="<?php echo SITE_URL.'index.php/admin';?>">后台管理</a>
    </div>

    <div class="navbar-collapse collapse" style="height: 1px;">
        <ul id="main-menu" class="nav navbar-nav navbar-right">
            <li class="dropdown hidden-xs">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    <span class="glyphicon glyphicon-user padding-right-small" style="position:relative;top: 3px;"></span><?=$username?><i class="fa fa-caret-down"></i>
                </a>

                <ul class="dropdown-menu">
                    <li><a href="#">我的信息</a></li>
                    <li class="divider"></li>
                    <li class="dropdown-header">管理界面</li>
                    <li><a href="<?php echo SITE_URL.'index.php/admin/logout';?>">退出</a></li>
                </ul>
            </li>
        </ul>

    </div>
</div>


<div class="sidebar-nav">
    <ul>
        <li><a href="#" data-target=".dashboard-menu" class="nav-header" data-toggle="collapse"><i class="fa fa-fw fa-dashboard"></i> 仪表盘<i class="fa fa-collapse"></i></a>
        </li>
        <li><ul class="dashboard-menu nav nav-list collapse in">
                <li><a href="<?php echo SITE_URL.'index.php/admin';?>"><span class="fa fa-caret-right"></span> 主界面</a></li>
                <li ><a href="<?php echo SITE_URL.'index.php/article/editor';?>"><span class="fa fa-caret-right"></span> 写文章</a></li>
                <li ><a href="<?php echo SITE_URL.'index.php/article/lists';?>"><span class="fa fa-caret-right"></span>文章列表</a></li>
                <!-- 暂时不用 -->
                <!--li ><a href="#"><span class="fa fa-caret-right"></span> 用户列表</a></li>
                <li ><a href="#"><span class="fa fa-caret-right"></span> 用户信息</a></li>
                <li ><a href="#"><span class="fa fa-caret-right"></span> 媒体</a></li-->
            </ul></li>

        <li data-popover="true" rel="popover" data-placement="right"><a href="#" data-target=".premium-menu" class="nav-header collapsed" data-toggle="collapse"><i class="fa fa-fw fa-fighter-jet"></i> 高级功能<i class="fa fa-collapse"></i></a></li>
        <!--li><ul class="premium-menu nav nav-list collapse">
                <li ><a href="#"><span class="fa fa-caret-right"></span> 升级用户</a></li>
                <li ><a href="#"><span class="fa fa-caret-right"></span> 插件</a></li>
                <li ><a href="#"><span class="fa fa-caret-right"></span> 更新时间列表</a></li>
                <li ><a href="#"><span class="fa fa-caret-right"></span> 媒体列表</a></li>
                <li ><a href="#"><span class="fa fa-caret-right"></span> 更多工具</a></li>
            </ul></li!-->

        <li><a href="#" data-target=".accounts-menu" class="nav-header collapsed" data-toggle="collapse"><i class="fa fa-fw fa-briefcase"></i>账户</a></li>
        <li><ul class="accounts-menu nav nav-list collapse">
                <li ><a href="<?php echo SITE_URL.'index.php/admin/accountinfo';?>"><span class="fa fa-caret-right"></span>账户信息</a></li>
                <li ><a href="<?php echo SITE_URL.'index.php/admin/logout';?>"><span class="fa fa-caret-right"></span>退出</a></li>
            </ul></li>

        <li><a href="#" data-target=".legal-menu" class="nav-header collapsed" data-toggle="collapse"><i class="fa fa-fw fa-legal"></i>法律信息<i class="fa fa-collapse"></i></a></li>
        <li><ul class="legal-menu nav nav-list collapse">
                <li ><a href="#"><span class="fa fa-caret-right"></span> 隐私权政策</a></li>
                <li ><a href="#"><span class="fa fa-caret-right"></span> 条款与条件</a></li>
            </ul></li>

        <li><a href="#" class="nav-header"><i class="fa fa-fw fa-question-circle"></i>帮助</a></li>
        <li><a href="#" class="nav-header"><i class="fa fa-fw fa-comment"></i>问与答</a></li>
    </ul>
</div>

<div class="content">
    <div class="header">
        <div class="stats">
            <!--p class="stat"><span class="label label-info">5</span> 通知</p>
            <p class="stat"><span class="label label-success">27</span> 任务</p>
            <p class="stat"><span class="label label-danger">15</span> 过期</p-->
        </div>

        <h1 class="page-title">仪表盘</h1>
        <ul class="breadcrumb">
            <li><a href="<?php echo SITE_URL.'index.php/admin';?>">管理主页</a> </li>
            <li class="active">文章列表</li>
        </ul>

    </div>
    <div class="main-content">



        <div class="row">
            <div class="col-sm-12 col-md-12">
                <table class="table-striped table table-bordered table-hover">
                    <tr>
                        <th>标题</th>
                        <th>创建时间</th>
                        <th>作者</th>
                        <th>类型</th>
                        <th>浏览量</th>
                        <th>操作</th>
                    </tr>
                    <?php
                    for($i=0;$i<count($blogs); $i++)
                    {
                        echo sprintf('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td><button class="delete btn btn-warning" value="%s" >删除</button><button class="update btn" value="%s">修改</button></td></tr>',$blogs[$i]->title,date("Y-m-d",$blogs[$i]->date),$author[$blogs[$i]->author],$sort[$blogs[$i]->sortid],$blogs[$i]->views,$blogs[$i]->qid,$blogs[$i]->qid);
                    }
                    ?>

                </table>
                <?php
                    echo $pageinfo;
                ?>
            </div>
        </div>



    </div>
    <footer>
        <hr>

        <!-- Purchase a site license to remove this link from the footer: http://www.portnine.com/bootstrap-themes -->
        <p class="pull-right">YZ Studio</a></p>
        <p>© <?= date('Y') ?> <a href="#" target="_blank">规划处</a></p>
    </footer>
</div>


<script src="<?php echo VIEW.'admin/'?>lib/bootstrap/js/bootstrap.js"></script>
<script>
    $(document).ready(function(){
        $(".delete").click(function(){
            $.post("<?php echo SITE_URL.'index.php/article/deletearticle' ?>",
                {
                    name:"Donald Duck",

                    qid:$(this).val()
                },
                function(data,status){
                    //alert(data);
                    console.log(data);
                    location.reload();
                    //alert($("#articletitle").val());
                });
            //alert(UE.getEditor('myEditor').getContent());

            //console.log($(this).val());
        });
        $(".update").click(function(){
            location.href = "<?php echo SITE_URL.'index.php/article/editor?qid='; ?>"+$(this).val();
            //alert(UE.getEditor('myEditor').getContent());

            //console.log($(this).val());
        });
    });
</script>

</body></html>
